<script>
    // 手机号码验证
    jQuery.validator.addMethod("isMobile2", function(value, element) {
        var length = value.length;
       var mobile = /^([0-9]{9})|([0-9]{10})|([0-9]{8})|(13[0-9]{9})|(18[0-9]{9})|(14[0-9]{9})|(17[0-9]{9})|(15[0-9]{9})$/;
		
        return this.optional(element) || (mobile.test(value));
    }, "请正确填写您的手机号码");
    $().ready(function () {
        $('#{:$vars['formId']}').validate({
            //debug: true,
            rules: {:json_encode($vars['rules'])},
            messages: {:json_encode($vars['messages'])},
            showErrors: function (errorMap, errorList) {
                var msg = "";
                $.each(errorList, function (i, v) {
                    layer.tips(v.message, v.element, { time: 1000, tips: [1,'#dd2727'] });
                    return false;
                });
            },
            onkeyup:false,
            onfocusout: false, /* 失去焦点时不验证 */
            submitHandler: function () {
                $('#{:$vars['formId']}').find("input[type='submit']").attr('autocomplete','off').prop('disabled',true);
                $.ajax({
                    type: "post",
                    url : "{:U($vars['ajaxAction'])}",
                    dataType:'json',
                    data:$('#{:$vars['formId']}').serialize(),
                    success: function(data){
             if(data['status']>0){
				/*
			  var return_url = $('#return_url').val();
			  var lw = 0;//$('#lw').val();
			  if(return_url!=''){
			  document.location = return_url;
			  }else if(lw==1){
			  var index = parent.layer.getFrameIndex(window.name); //
                 parent.location.reload();
			    parent.layer.close(index);
				
				  }else{
					  */
			   document.location = "{:urlrotue('/')}";
			
			  //{:$vars['successJs']}
			//var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
			//登录成功之后弹出预约信息界面
                parent.layer.close(index); //再执行关闭--关闭登录界面
							
                           
                        }else{
                            layer.msg(data['info'], {icon: 5});
							$('#{:$vars['formId']}').find("input[type='submit']").attr('autocomplete','').prop('disabled',false);
                            {:$vars['errorJs']}
                        }
                    }
                });
            }
        });
    });
</script>